#ifndef BRONCHO_LOG_H
#define BRONCHO_LOG_H


#ifdef RIL_FILE_LOG

#define ALOGE broncho_log
#define ALOGD broncho_log
#define ALOGI broncho_log

#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <unistd.h>


static void broncho_log (const char* message_format, ...)
{
	va_list     args;
	FILE* fp = NULL;
	static char* s_broncho_log_str = NULL;

	if (s_broncho_log_str == NULL)
	{
		s_broncho_log_str = alloca(1024*3);
	}

	va_start (args, message_format);
	vsprintf(s_broncho_log_str, message_format, args);
	va_end (args);

	if ((fp = fopen ("/data/broncho.log", "ab+")) != NULL)
	{
		char pid[20] = {0};

		snprintf(pid, 20, "%d: ", getpid());
		fputs (pid, fp);
		fputs (s_broncho_log_str, fp);
		fclose (fp);
	}

	return;
}

#else
#	ifdef BRONCHO_TEST
#		define ALOGE printf 
#		define ALOGD printf
#		define ALOGI printf
#	else
#		include <utils/Log.h>
#	endif
#endif
#endif

